package cn.ht.bootdemo.designmode.facAndmethod.service.impl;

import cn.ht.bootdemo.common.enums.ServiceEnum;
import cn.ht.bootdemo.designmode.facAndmethod.factory.UserServiceStrategyFactory;
import cn.ht.bootdemo.designmode.facAndmethod.service.UserPayService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.math.BigDecimal;

/**
 * @author ht
 * @Description: 超级会员8折
 * @date 2020-5-11
 */
@Service
public class SuperVipServiceImpl implements UserPayService, InitializingBean {

    @Override
    public BigDecimal quote(BigDecimal bigDecimal) {
        Assert.notNull(bigDecimal,"请输入价格");
        return new BigDecimal("8");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        UserServiceStrategyFactory.register(ServiceEnum.SUP_VIP_USER.getValue(),this);
    }
}
